package objects;

import world.BodyID;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.tiled.TiledMap;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.World;

public class Crystal extends AbstractObject {

	public Crystal(TiledMap tiledMap, World _world, int posX, int posY) {
		this.type = BodyDef.BodyType.StaticBody;

//		this.position
//				.set((posX + tiledMap.tileWidth / 2) / PIXELS_PER_METER,
//						(tiledMap.height * tiledMap.tileHeight - (posY - tiledMap.tileHeight / 2))
//								/ PIXELS_PER_METER);
		this.position
		.set((posX  / PIXELS_PER_METER),
				(tiledMap.height * tiledMap.tileHeight - (posY ))/ PIXELS_PER_METER);
	
//		sprite = new Sprite(new Texture(Gdx.files.internal("data/sprites/crystal.png")));
		

		world = _world;
		body = world.createBody(this);
		body.setUserData(BodyID.COIN);
		body.setActive(true);

		CircleShape circleShape = new CircleShape();
		circleShape.setRadius((32 / 2) / PIXELS_PER_METER);

		FixtureDef fixtureDef = new FixtureDef();
		fixtureDef.shape = circleShape;
		fixtureDef.isSensor = true;
		body.createFixture(fixtureDef);
	}

}
